//
//  My_EInvitationListCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/29.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "My_EInvitationListCell.h"

@implementation My_EInvitationListCell

- (void)awakeFromNib {
    [super awakeFromNib];


}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.mainImageView pp_clipCorners:UIRectCornerAllCorners radius:8];
    });
}

- (void)fillCellWithModel:(CommonEinvitationModel *)model {
    
    [self.mainImageView sd_setImageWithURL:[NSURL URLWithString:model.invitationImage] placeholderImage:[UIImage imageNamed:@""] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
        
        if (image) {
         
            if (cacheType != SDImageCacheTypeMemory) {
                [UIView transitionWithView:self.mainImageView duration:0.61 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
                    [self.mainImageView setImage:image];
                    self.mainImageView.alpha = 1.0;
                } completion:nil];
            } else {
                self.mainImageView.alpha = 1.0;
                [self.mainImageView setImage:image];
            }
        }
        
    }];
    self.lastEditTime.text = model.updateTime;
}


- (IBAction)shareAction:(id)sender {
    if (self.My_EInvitationListCellBlock) {
        self.My_EInvitationListCellBlock(My_EInvitationListCellActionType_share);
    }
}

- (IBAction)msgAction:(id)sender {
    
}

- (IBAction)deleteAction:(id)sender {
    if (self.My_EInvitationListCellBlock) {
        self.My_EInvitationListCellBlock(My_EInvitationListCellActionType_del);
    }
}

@end
